package com.imodia.checkoo.thread.htmlInfo;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.hsq.commons.util.HttpUtil;
import com.hsq.commons.util.file.FileUtil;

public class ThreadTaskExecutorHtml implements Runnable {
	
	private static final Log log = LogFactory.getLog(ThreadTaskExecutorHtml.class);

	private String url;

	private String fileName;

	ThreadTaskExecutorHtml(String url, String fileName) {
		this.url = url;
		this.fileName = fileName;
	}

	public void run() {
		String content = HttpUtil.GetResponseGBK(url);
		log.info("_______________url:"+url);
		if (content == null)
			return;
		if (content.trim().equals("-1"))
			return;
		FileUtil.writeFile(content, fileName);
		try {
			Thread.sleep(500);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

}
